package com.irdstudio.efp.nls.common.constant;

import java.util.stream.Stream;

/**
 * 尊享贷授信的产品插槽
  * @author heyingfeng
  * @since 2019年3月6日 下午5:22:33
  * @version 1.0
 */
public enum ZXDAdaptedSoltEnum {

	SOLT_APPLY_ACCESS("01010002", "soltApplyAccess", "准入判断服务", "creditAccessRuleService", "1", 1),
	SOLT_APPLY_BLACK("01010002", "soltApplyBlack", "黑名单判断服务", "creditBlackService", "1", 2),
	SOLT_APPLY_PBOC("01010002", "soltApplyPboc", "征信判断服务", "creditZXRuleService", "1", 3),
	SOLT_APPLY_BD_PBOC("01010002", "soltBdApplyPboc", "百度征信判断服务", "creditBdZxRuleService", "1", 4),
	SOLT_APPLY_CUS_CREATE("01010002", "soltAcceptCus", "客户建档服务", "creditCusCreateService", "1", 5),
	SOLT_LOAN_LMT("01010002", "soltApplyLmt", "额度生成服务", "creditLmtService", "1", 6),
	
	SOLT_LETTER_ACCESS("01010002", "soltLetterAccess", "用信准入判断服务", "letterRuleService", "2", 1),
	
	SOLT_RULE_JUDGE("01010002", "soltRuleJudge",  "调额规则判断服务", "lmtAdjAccessRuleService", "3", 1);
	
	private String prdId;// 产品ID
	private String soltCode;// 插槽代码
	private String soltName;// 插槽名称
	private String soltService;// 插槽服务类
	private String soltStage;// 插槽阶段类
	private int soltOrder;// 插槽顺序

	public String getPrdId() {
		return prdId;
	}

	public String getSoltCode() {
		return soltCode;
	}

	public String getSoltName() {
		return soltName;
	}

	public String getSoltService() {
		return soltService;
	}
	
	public String getSoltStage() {
		return soltStage;
	}

	public int getSoltOrder() {
		return soltOrder;
	}

	private ZXDAdaptedSoltEnum(String prdId, String soltCode, String soltName, String soltService, String soltStage, int soltOrder) {
		this.prdId = prdId;
		this.soltCode = soltCode;
		this.soltName = soltName;
		this.soltService = soltService;
		this.soltStage = soltStage;
		this.soltOrder = soltOrder;
	}

	public static ZXDAdaptedSoltEnum parse(String prdId, String soltCode) {
		return Stream.of(ZXDAdaptedSoltEnum.values()).filter(value -> value.prdId.equals(prdId) && value.soltCode.equals(soltCode))
				.findFirst().orElseThrow(RuntimeException::new);

	}

	public boolean validateSoltService(String soltName, String soltService, String soltStage, int soltOrder) {
		return this.soltName.equals(soltName) && this.soltService.equals(soltService) && this.soltStage.equals(soltStage) && this.soltOrder == soltOrder;
	}

}
